package unclassified.medium;

import java.util.HashMap;
import java.util.Map;
import java.util.Scanner;

public class VaildTicTacToeState_794 {

    public boolean validTicTacToe(String[] board) {
        char[][] res = new char[3][3];
        int x = 0, o = 0;
        for (int i = 0; i < 3; i++) {
            for (int j = 0; j < 3; j++) {
                char c = board[i].charAt(j);
                if (c == 'X')
                    x++;
                else if (c == 'O')
                    o++;
                res[i][j] = c;
            }
        }
        boolean bx = check(res, 'X'), bo = check(res, 'O');
        if (o > x || x - o > 1) return false;
        if (bx && x <= o) return false;
        if (bo && o != x) return false;
        if (bx && bo) return false;
        return true;
    }

    public boolean check(char[][] cr, char c){
        for (int i = 0; i < 3; i++) {
            if (cr[i][0] == c && cr[i][1] == c && cr[i][2] == c)
                return true;
            if (cr[0][i] == c && cr[1][i] == c && cr[2][i] == c)
                return true;
        }
        boolean a = true, b = true;
        for (int i = 0; i < 3; i++) {
            for (int j = 0; j < 3; j++) {
                if (i == j)
                    a = a & cr[i][j] == c;
                if (i + j == 2)
                    b = b & cr[i][j] == c;
            }
        }
        return a || b;
    }

    public static void main(String[] args) {
        System.out.println("请输入刘同学的考试成绩");
        Scanner sc = new Scanner(System.in);
        int i = sc.nextInt();
        if (i == 100) {
            System.out.println("买辆车");
        } else if (i >= 90) {
            System.out.println("买台笔记本电脑");
        } else if (i >= 60) {
            System.out.println("买部手机");
        } else {
            System.out.println("没有礼物");
        }

    }
}
